﻿<?php
include("../Modules/admin_resist_mdl.php");
// include('doctype.htm');
?>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript"> 
	

</script>

</head>

<body>
<script language="javascript">
	
	// Kiem tra cac truong trong form co bi bo trong hay khong
	function emptyCheck()
	{
		if ( (document.frmEditCNBM.txtMSBM.value == "")  ||
			 (document.frmEditCNBM.txtTenBM.value == "")	)
		
				document.frmEditCNBM.smtCNBM.disabled = true;
		
		else document.frmEditCNBM.smtCNBM.disabled = false;
	}
	
</script>

<h4>Sửa thông tin bộ môn</h4>

<?php
	include("../../Modules/conn.php");
	
	$msbm = @$_GET["msbm"];
	$query1 = "select * from bo_mon where MSBM = '$msbm'";
	$result1 = mysql_query($query1);
	$row1 = mysql_fetch_array($result1);
?>

<form method="POST" action="../Modules/admin_editcnbm.php?msbm=<?php echo $msbm; ?>" name="frmEditCNBM" onreset="this.smtCNBM.disabled = true">
	<ul>
		<li>
			<span>Mã bộ môn</span>
			<input type="text" name="txtMSBM" value="<?php echo $row1['MSBM']; ?>" onkeyup="emptyCheck();">
		</li>
		
		<li>
			<span>Tên bộ môn</span>
			<input type="text" name="txtTenBM" value="<?php echo $row1['TEN_BM']; ?>" onkeyup="emptyCheck();">
		</li>
		
		<li>
			<span>Khoa</span>
			<select name="cboKhoa" onchange="emptyCheck();">
				<?php
					$query2 = "select * from khoa";
					$result2 = mysql_query($query2, $conn) or die(mysql_error());
					while ($row2 = mysql_fetch_array($result2))
					{
						echo '<option value="'.$row2['MA_KHOA'].'"';
						
						// Dat gia tri combobox la gia tri trong csdl
						if ($row1['MA_KHOA'] == $row2['MA_KHOA'])
							echo " selected";
						
						echo '>'.$row2['TEN_KHOA'].'</option>';
					}
				?>
			</select>
		</li>
		
		<li>
			<input type="submit" value="Lưu" name="smtCNBM" disabled="true">
			<input type="reset" value="Nhập lại" name="resCNBM">
		</li>
	</ul>
</form>

</body>

</html>